﻿using FluentNHibernate.Mapping;
using Journal.Domain.Models;

namespace Journal.NHibernate.Mappings
{
    public class EntityMenuItemMap : ClassMap<EntityMenuItem>
    {
        public EntityMenuItemMap()
        {
            Id(x => x.Id).Not.Nullable().GeneratedBy.Identity();
            Map(x => x.Name).Length(50).Not.Nullable();
            HasManyToMany(x => x.Sections).Table("EntityMenuItemToSection").ChildKeyColumn("EntityMenuItemId").ParentKeyColumn("SectionId").Cascade.None();
        }
    }
}